<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <!-- 李义根 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css"
	href="../js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/demo/demo.css">
<link rel="stylesheet" type="text/css" href="../css/ticket.css">
<script type="text/javascript" src="../js/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	var url;
	<!--修改 -->
	function editorder() {
		var oid = document.getElementById("oidd").value;   
		var row = $('#dg').datagrid('getSelected'); 
		if (row) {
			$('#dlg').dialog('open').dialog('setTitle', '修改 ');
			/* $('#fm').form('load'); */ 
			var t=row['train']; 
		 	url = '../orderServlet?param=update&train='+t+'oid'+oid; 
			/*  url="showorder.jsp?oid="+oid+'&train'+train;
			 window.location.href=url; */
		}
	}
	function chose() {
		$('#fm').form('submit', {
			url : url,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(result) {

				var date = eval('(' + result + ')');
				if (date.success) {
					$('#dlg').dialog('close'); // close the dialog
					$('#dg').datagrid('reload'); // reload the user data
				} else {
					$.messager.show({
						title : 'Error',
						msg : result.msg
					});
				}
			}
		});
	}
 
	Date.prototype.format = function(format) {  
	    var o = {  
	        "M+": this.getMonth() + 1, // month  
	        "d+": this.getDate(), // day  
	        "h+": this.getHours(), // hour  
	        "m+": this.getMinutes(), // minute  
	        "s+": this.getSeconds(), // second  
	        "q+": Math.floor((this.getMonth() + 3) / 3),   
	        "S": this.getMilliseconds()  
	        // millisecond  
	    }  
	    if (/(y+)/.test(format))  
	        format = format.replace(RegExp.$1, (this.getFullYear() + "")  
	            .substr(4 - RegExp.$1.length));  
	    for (var k in o)  
	        if (new RegExp("(" + k + ")").test(format))  
	            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
	    return format;  
	}  
	 
	$(document).ready(function () {
		var oid = document.getElementById("oidd").value;
		$('#dg').datagrid({
		    pagination:true,
		    fitColumns:true,
		    singleSelect:true,
		    rownumbers:true,
		    url:'../selectOrderServlet?param=selectone&oid='+oid,
		    columns:[[
		        {field:'train',title:'车次',width:30},
		        {field:'times',title:'时间',width:30,formatter:formatDatebox}, 
		        {field:'splace',title:'出发地',width:30},
		        {field:'eplace',title:'目的地',width:30}, 
		        {field:'price',title:'价格',width:30},
		        {field:'nums',title:'数量',width:30}
		    ]]
		});
	
	function formatDatebox(value) {  
	    if (value == null || value == '') {  
	        return '';  
	    }  
	    var dt;  
	    if (value instanceof Date) {  
	        dt = value;  
	    } else {  
	        dt = new Date(value);  
	    }  
	  
	    return dt.format("yyyy-MM-dd hh:mm:ss"); //扩展的Date的format方法(上述插件实现)  
	}
	});
	$(document).ready(function () {
	 var p = $('#dg').datagrid('getPager');  
	                $(p).pagination({  
	                pageSize: 10,//每页显示的记录条数，默认为5  
	                pageList: [10, 20 ,30],//可以设置每页记录条数的列表  
	                beforePageText: '第',//页数文本框前显示的汉字  
	                afterPageText: '页    共 {pages} 页',  
	                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
	            });  
	
	}); 
	
</script>
<title>修改订单</title>
</head>
<body>
<div><div id="top" >
   <table width="100%"  align="center">
  <tr>
    <td width="1411" colspan="2" background="../images/ny_top_img_bg.gif"><img src="../images/ny_top_img.gif" width="650" height="108"></td>
    </tr>
 </table>
	</div>
  <div id="navi" >
  	<span id="cr">当前选择》》订单修改</span>
	<span id="user">欢迎您${sessionScope.username},退出</span>
  </div>
  <div id="menu">
  <table width="247">
  
	<tr>
	<td width="75">&nbsp;</td>
	<td width="165" height="35"><span class="text_blod">用户</span></td></tr>
	<tr>
	<td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray">车票预订</td>
	</tr>
	<tr><td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray">个人信息</td></tr>
	<tr><td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray"><a href="../orders/showorder.jsp">订单详情</a></td></tr>

  
  </table>
  
  </div>
     <h2>订单修改</h2>
	<div class="demo-info" style="margin-bottom: 10px">
		<div class="demo-tip icon-tip"> </div>
		<div>点击下面的功能按钮，实现对订单的修改</div>
	</div>
	<table id="dg" title="订单修改" class="easyui-datagrid"
		style="width: 1041px; height: 430px" toolbar='#toolbar',>
		 
	</table>
	<div id="toolbar">
		<a href="showorder.jsp" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editorder()"> 选择</a> 
	</div>
    <% 
    
       String oid=request.getParameter("oid");
       String sp=request.getParameter("sp");
       String ep=request.getParameter("ep");
    
    %>
    <div>
      <input type="hidden" value=<%=oid%>  id="oidd">
    
    </div>
	</div>
</body>
</html>
